Tessék, de nem én irtam.
if(strcmp(cmd, \"/give\", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /give [name] [playerid/PartOfName] (loszer])\");
return 1;
}
else if(strcmp(x_nr,\"gun\",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, \"USAGE: /give gun [playerid/PartOfName]\");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(5.0, playerid, giveplayerid))
{
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(gunID != 0 && gunAmmo != 0)
{
GivePlayerWeapon(giveplayerid, gunID, gunAmmo);
RemovePlayerWeapon(playerid, gunID);
format(string, sizeof(string), \"* %s oda ad egy fegyvert %s-nek.\", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, \"Neked nincs meg ez a fegyver!\");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, \"Játékos nincs a közeledbe!\");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /give [name] [playerid/PartOfName] ([ammount])\");
return 1;
}
}
return 1;
}
Az ütközéses:
#include <a_samp>
#define RED 0xAA3333AA
new bool:IsSpeeding[MAX_PLAYERS],
playerspeedtimer[MAX_PLAYERS],
CrashTimer[MAX_PLAYERS],
Float:pSpeed[MAX_PLAYERS];
public OnFilterScriptInit()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
IsSpeeding = false;
}
return 1;
}
public OnPlayerConnect(playerid)
{
playerspeedtimer[playerid] = SetTimerEx(\"VehicleSpeed\", 100, 1, \"i\", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(playerspeedtimer[playerid]);
KillTimer(CrashTimer[playerid]);
IsSpeeding[playerid] = false;
return 1;
}
forward VehicleSpeed(playerid);
public VehicleSpeed(playerid)
{
new Float:ovx, Float:ovy, Float:ovz;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), ovx, ovy, ovz);
if(ovx < -0.4 || ovx > 0.4 || ovy < -0.4 || ovy > 0.4 && !IsSpeeding[playerid])
{
CrashTimer[playerid] = SetTimerEx(\"Speeding\", 100, 1, \"i\", playerid);
ovx = (ovx >= 0) ? ovx : -ovx;
ovy = (ovy >= 0) ? ovy : -ovy;
pSpeed[playerid] = ((ovx+ovy)/2);
IsSpeeding[playerid] = true;
}
else
{
KillTimer(CrashTimer[playerid]);
pSpeed[playerid] = 0.0;
IsSpeeding[playerid] = false;
}
}
return 1;
}
forward Speeding(playerid);
public Speeding(playerid)
{
new Float:nvx, Float:nvy, Float:nvz;
if(IsPlayerInAnyVehicle(playerid) && IsSpeeding[playerid])
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), nvx, nvy, nvz);
if(nvx > -0.1 && nvx < 0.1 && nvy > -0.1 && nvy < 0.1)
{
new Float:crashhealth;
GetPlayerHealth(playerid, crashhealth);
crashhealth -= (pSpeed[playerid] * 100.0);
SetPlayerHealth(playerid, crashhealth);
SetPlayerDrunkLevel(playerid, 50000);
SetTimerEx(\"StopCameraEffect\", 5000, 0, \"i\", playerid);
IsSpeeding[playerid] = false;
}
}
return 1;
}
forward StopCameraEffect(playerid);
public StopCameraEffect(playerid)
{
SetPlayerDrunkLevel(playerid, 0);
return 1;
}
A szkriptet Mikee írta a pawno-sa-mp.extra.hu oldalon.