GTAvision.com - Forum - Grand Theft Auto News, Downloads, Community and more...

Position: Grand Theft Auto: San Andreas » Multiplayer » Scripte und kleine Codes » [SA-MP] Scripting Funktionen » Druckansicht
N0rax, 11.07.2010, 19:48
Hey,

ich hab mal alle Scripting-Stock's zusammengefasst, die ich für unseren sXp-Network SA-MP Server
benutze:

Spoiler: Codes

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
stock AddStaticVehicle2(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle) return 
AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, -1, -1);

stock AddPlayerClass2(modelid,Float:spawn_x,Float:spawn_y,Float:spawn_z,Float:z_angle) return AddPla
yerClass(modelid,Float:spawn_x,Float:spawn_y,Float:spawn_z,Float:z_angle,0,0,0,0,0,0);

stock sXpAdministrator(playerid) return Admin[playerid] = Admin[playerid];

stock sXpModerator(playerid) return Moderator[playerid] = Moderator[playerid];

stock ClearText10(playerid)
{
for (new a=1;a<=10;a++)
{
SendClientMessage(playerid,0xFFFFFFFF,"\n");
}
return 1;
}

stock ClearText5(playerid)
{
for (new a=1;a<=5;a++)
{
SendClientMessage(playerid,0xFFFFFFFF,"\n");
}
return 1;
}

stock ClearText2(playerid)
{
for (new a=1;a<=2;a++)
{
SendClientMessage(playerid,0xFFFFFFFF,"\n");
}
return 1;
}

stock ClearTextAll2()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
for (new a=1;a<=2;a++)
{
SendClientMessage(i,0xFFFFFFFF,"\n");
}
}
}
}

stock PlayerName(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
return pname;
}

stock PlayerIP(playerid)
{
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, MAX_PLAYER_NAME);
return ip;
}


stock GivePlayerCoins(playerid, coinamount)
{
if (coins[playerid] + coinamount > 500) coins[playerid] = 500;
else coins[playerid] = coins[playerid] + coinamount;
}

stock GetPlayerCoins(playerid) return coins[playerid];

stock SetPlayerCoins(playerid, coinamount)
{
if (coinamount > 500) coins[playerid] = 500;
else coins[playerid] = coinamount;
}

stock ResetPlayerCoins(playerid) coins[playerid] = 0;

stock PlaySound(playerid,soundid)
{
if (IsPlayerConnected(playerid))
{
new Float:X,Float:Y,Float:Z;
PlayerPlaySound(playerid,soundid,X,Y,Z);
}
}

stock DisableWord(const badword[], text[])
{
for(new i=0; i<256; i++) {
if (strfind(text[i], badword, true) == 0) {
for(new a=0; a<256; a++) {
if (a >= i && a < i+strlen(badword)) text[a]='*';

}
}
}
}

stock IsPlayerInArea(playerid, Float:x_min, Float:x_max, Float:y_min, Float:y_max)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if (X >= x_min && X <= x_max && Y >= y_min && Y <= y_max) return 1;
return 0;
}

stock ResetPlayerScore(playerid,scores) return SetPlayerScore(playerid,GetPlayerScore(playerid) -sco
res);

stock GivePlayerScore(playerid,scores) return SetPlayerScore(playerid,GetPlayerScore(playerid) +scor
es);

stock CrashPlayer(playerid)
{
for(new i=0;i<=50;i++)
{
new temp = CreateVehicle(476,0,0,0,0,0,0,0);
LinkVehicleToInterior(temp,1050);
PutPlayerInVehicle(playerid,temp,4);
SetPlayerInterior(playerid,20);
SetPlayerVirtualWorld(playerid,17);
SetVehicleVirtualWorld(temp,14518);
DestroyVehicle(temp);
}
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
return 1;
}

stock TeleportPlayerToPlayer(playerid, gotoID)
{
new Float: X, Float: Y, Float Z, pWorld pInt;
GetPlayerPos(gotoID,X,Y,Z); pWorld = GetPlayerVirtualWorld(gotoID); pInt = GetPlayerInterior(gotoID);

if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid),X+3,Y,Z);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
SetPlayerInterior(playerid, pInt);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), pWorld);
} else {
SetPlayerPos(playerid,X+2,Y,Z);
SetPlayerVirtualWorld(playerid, pWorld);
SetPlayerInterior(playerid, pInt);
}
}

stock Teleport(playerid, Float:X, Float:Y, Float:Z,Float:ang)
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID = GetPlayerVehicleID(playerid);
SetVehiclePos(VehicleID, X, Y, Z);
SetPlayerFacingAngle(playerid,Float:ang);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid,Float:ang);
}
}


stock GivePlayerVehicle(playerid, vehicleid)
{
if(!IsPlayerInAnyVehicle(playerid) && vehicleid > 399 && vehicleid < 612)
{
new Float:x, Float:y, Float:z, Float:a, vehicle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
vehicle = CreateVehicle(vehicleid, x, y, z, a, -1, -1, 50000);
PutPlayerInVehicle(playerid, vehicle, 0);
}
}

stock DisconnectNPC(npcname[]) {
new
n[MAX_PLAYER_NAME],x=0;
while(x!=GetMaxPlayers()) {
GetPlayerName(x,n,sizeof n);
if(!strcmp(n,npcname,true)) break;
x++;
}
if(x==GetMaxPlayers())return INVALID_PLAYER_ID;
Kick(x);
return 1;
}

stock GetPlayerID(playerid) return playerid;

stock GiveVehicleNitro(playerid)
{
if (IsPlayerConnected(playerid))
{
if (IsPlayerInAnyVehicle(playerid))
{
new vid = GetPlayerVehicleID(playerid);
AddVehicleComponent(vid, 1010);
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du musst in einem Fahrzeug sitzen!");
}
}
}




Wie füg ich diese in meinem Gamemode ein?

Ganz oben über main().
N0rax, 15.07.2010, 23:08
Hinweis:

Code:
1
stock GetPlayerID(playerid) return playerid;


Ergiebt den gleichen Sinn wie "playerid" das heißt wenn ihr jetzt ein format text anwendet, könnt
ihr auch sogut wie "playerid" hinschreiben statt "GetPlayerID" da dies das gleiche ist!

Beispiel:

Code:
1
2
3
4
5
printf("Die ID: %d betritt den Server.",playerid);

oder

printf("Die ID: %d betritt den Server.",GetPlayerID(playerid);



Danke an Rafioso für die verbesserung!
GTAvision.com :: Forumregeln :: FAQ :: Impressum :: Kontakt :: RDRvision.com :: LANOIREvision.com :: MaxPayneVision.com
NetVisionWork.NET
.: © 2006-2014 by GTAvision.com :.

Rockstar GamesTake-Two Interactive Deutschland

Free Grand Theft Auto Downloads